﻿@model SMECustomerWebsite.Models.ViewModels.DaoManager.DaoInfoViewModel
@if (Model.CurrentUser != null && Request.Cookies[Model.CurrentUser.UserName + "CRDError"] != null)
{
    <div class="alert alert-danger alert-dismissible fade in" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">×</span>
        </button>
        @Request.Cookies[Model.CurrentUser.UserName + "CLDError"].Value
    </div>
}
<div class="col-md-12 col-sm-12 col-xs-12">
    <div class="x_panel">
        <div class="x_title">
            <h2><i class="fa fa-bars"></i> @SMECustomerWebsite.Core.Resources.Resource.Option 1 <small>@SMECustomerWebsite.Core.Resources.Resource.AddnewByExcel</small></h2>
            <ul class="nav navbar-right panel_toolbox">
                <li>
                    <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                </li>
            </ul>
            <div class="clearfix"></div>
        </div>
        <div class="x_content">
            @Html.Partial("AddCreateDaoRequestByExcel")

        </div>
    </div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
    <div class="x_panel">
        <div class="x_title">
            <h2><i class="fa fa-bars"></i> @SMECustomerWebsite.Core.Resources.Resource.Option 2 <small>@SMECustomerWebsite.Core.Resources.Resource.AddnewByInput</small></h2>
            <ul class="nav navbar-right panel_toolbox">
                <li>
                    <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                </li>
            </ul>
            <div class="clearfix"></div>
        </div>
        <div class="x_content">

            @Html.Partial("AddCreateDaoRequestByInput")
        </div>
    </div>
</div>

@section scripts
{
    <!-- validator -->
    <script src="~/Scripts/vendors/validator/validator.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            eraseCookie('@Model.CurrentUser.UserName' + 'CRDError');
            $('#position_name').select2({
                placeholder: 'Chọn vị trí'
            });
            $('#branch_register').select2({
                placeholder: 'Chọn trung tâm'
            });
        })

    </script>
    <!-- validator -->
    <script>
        // initialize the validator function
        validator.message.date = 'not a real date';

        // validate a field on "blur" event, a 'select' on 'change' event & a '.reuired' classed multifield on 'keyup':
        $('form')
          .on('blur', 'input[required], input.optional, select.required', validator.checkField)
          .on('change', 'select.required', validator.checkField)
          .on('keypress', 'input[required][pattern]', validator.keypress);

        $('.multi.required').on('keyup blur', 'input', function () {
            validator.checkField.apply($(this).siblings().last()[0]);
        });

        $('form').submit(function (e) {
            e.preventDefault();
            var submit = true;

            // evaluate the form using generic validaing
            if (!validator.checkAll($(this))) {
                submit = false;
            }

            if (submit)
                this.submit();

            return false;
        });
    </script>
    <!-- /validator -->
}